<template>
  <a-select v-bind="$attrs" :disabled="disabled">
    <slot></slot>
  </a-select>
</template>
<script setup>
import { computed, useAttrs } from 'vue'
import { useStore } from 'vuex'

const attrs = useAttrs()
const store = useStore()

const props = defineProps({
  authKey: {
    type: String,
    default: ''
  }
})

const disabled = computed(() => {
  if (props.authKey) {
    const flag = store.state.buttonRoot[props.authKey]
    return !flag || attrs.disabled
  }
  return attrs.disabled
})
</script>

<style lang="scss" scoped></style>
